package server;

/**
 * @author kangshuai
 */
public class HttpProtocolUtil {

    public static String str404 = "<h1>404 not found</h1>";

    /**
     * 为响应码200提供请求头信息，和传递北内容封装
     *
     * @return
     */
    public static String getHttpHeader200(long contentLength) {
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + contentLength + " \n" +
                "\r\n";
    }

    /**
     * 为响应码404提供请求头信息，和404提示内容
     *
     * @return
     */
    public static String getHttpHeader404() {
        return "HTTP/1.1 404 NOT Found \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + str404.length() + " \n" +
                "\r\n" + str404;
    }
}
